<?php
class GetRecycle{
	private $label_tandan;
	private $db;
	
	function GetRecycle($db=NULL, $label_tandan=NULL){
		$this->label_tandan  = $label_tandan;
		$this->db 			 = $db;
	}	
	
	function response(){
		// ruang panas
		$q = "
		SELECT `jml_biji_terima`, `jml_biji_discard`, `jml_biji_seleksi`
		FROM `caramel_operational`.`inv_ruang_panas` WHERE `label_tandan`='".$this->label_tandan."'";
		$r = $this->db->get_results($q);
		if( $r ){
			$r = $r[0];
			
			// germinasi
			$q = "
				SELECT `jml_biji_belum_tumbuh`
				FROM `caramel_operational`.`inv_germinasi` WHERE `label_tandan`='".$this->label_tandan."'";
			$r->jml_biji_belum_tumbuh = $this->db->get_var($q);
			
			echo json_encode($r);
		}
		else
			echo "false";
	}	
}

$label_tandan	= $_GET['label_tandan'];

/
// load database class handler
include_once '../config/db_config.php';
include '../library/ezsql/shared/ez_sql_core.php';
include '../library/ezsql/mysql/ez_sql_mysql.php';

// database handler
$db = new ezSQL_mysql($dbUser, $dbPass, $dbName, $dbHost);

$finder = new GetRecycle($db, $label_tandan);
$finder->response();
?>